home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Windows / StrangeWindow.cp < prev    next >
Text File  |  2000-06-23  |  2KB  |  104 lines

  1. // StrangeWindow.cp
  2.  
  3. #ifndef StrangeWindow_h
  4. #include "StrangeWindow.h"
  5. #endif
  6. #ifndef WindowUpdater_h
  7. #include "WindowUpdater.h"
  8. #endif
  9. #ifndef MouseDownEvent_h
  10. #include "MouseDownEvent.h"
  11. #endif
  12. #ifndef GrayRegion_h
  13. #include "GrayRegion.h"
  14. #endif
  15. #ifndef SplitIntegers_h
  16. #include "SplitIntegers.h"
  17. #endif
  18. #ifndef RegionObject_h
  19. #include "RegionObject.h"
  20. #endif
  21. #ifndef CursorObject_h
  22. #include "CursorObject.h"
  23. #endif
  24.  
  25. void StrangeWindow::Update()
  26.   {
  27.     Assert( window != 0 );
  28.     WindowUpdater updater( *window );
  29.   }
  30.  
  31. void StrangeWindow::Activate()
  32.   {
  33.     Assert( window != 0 );
  34.   }
  35.  
  36. void StrangeWindow::Deactivate()
  37.   {
  38.     Assert( window != 0 );
  39.   }
  40.  
  41. void StrangeWindow::ClickContent( const MouseDownEvent& )
  42.   {
  43.     Assert( window != 0 );
  44.     if ( !window->IsFrontmost() )
  45.         SelectWindow( &window->Port() );
  46.   }
  47.  
  48. void StrangeWindow::ClickDrag( const MouseDownEvent& click )
  49.   {
  50.     Assert( window != 0 );
  51.     if ( !window->IsFrontmost() && !click.Command() )
  52.         SelectWindow( &window->Port() );
  53.     
  54.     Rectangle bounds = GrayRegion::The().Bounds();
  55.     DragWindow( &window->Port(), click.GlobalPoint(), &bounds );
  56.   }
  57.  
  58. void StrangeWindow::ClickClose( const MouseDownEvent& click )
  59.   {
  60.     Assert( window != 0 );
  61.     Assert( window->IsFrontmost() );
  62.     
  63.     if ( TrackGoAway( &window->Port(), click.GlobalPoint() ) )
  64.         HideWindow( &window->Port() );
  65.   }
  66.  
  67. void StrangeWindow::ClickZoomIn( const MouseDownEvent& click )
  68.   {
  69.     Assert( window != 0 );
  70.     Assert( window->IsFrontmost() );
  71.  
  72.     if ( TrackBox( &window->Port(), click.GlobalPoint(), inZoomIn ) )
  73.         ZoomWindow( &window->Port(), inZoomIn, true );
  74.   }
  75.  
  76. void StrangeWindow::ClickZoomOut( const MouseDownEvent& click )
  77.   {
  78.     Assert( window != 0 );
  79.     Assert( window->IsFrontmost() );
  80.  
  81.     if ( TrackBox( &window->Port(), click.GlobalPoint(), inZoomOut ) )
  82.         ZoomWindow( &window->Port(), inZoomOut, true );
  83.   }
  84.  
  85. void StrangeWindow::ClickGrow( const MouseDownEvent& click )
  86.   {
  87.     Assert( window != 0 );
  88.     Assert( window->IsFrontmost() );
  89.  
  90.     static const Rect limits = { 64, 64, maxint16, maxint16 };
  91.     
  92.     uint32 result = GrowWindow( &window->Port(), click.GlobalPoint(), &limits );
  93.     
  94.     if ( result != 0 )
  95.         SizeWindow( &window->Port(), Word0( result ), Word1( result ), true );
  96.   }
  97.  
  98. const CursorObject& StrangeWindow::Cursor( const MouseEvent&,
  99.                                                          RegionObject& sleep )
  100.   {
  101.     sleep = Rectangle::big;
  102.     return CursorObject::Arrow();
  103.   }
  104.